package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.JumboPlatesStockIn;
import com.ruoyi.system.service.IJumboPlatesStockInService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 原片入库Controller
 *
 * @author ruoyi
 * @date 2025-06-09
 */
@RestController
@RequestMapping("/system/in")
public class JumboPlatesStockInController extends BaseController
{
    @Autowired
    private IJumboPlatesStockInService jumboPlatesStockInService;

    /**
     * 查询原片入库列表
     */
    @PreAuthorize("@ss.hasPermi('system:in:list')")
    @GetMapping("/list")
    public TableDataInfo list(JumboPlatesStockIn jumboPlatesStockIn)
    {
        startPage();
        List<JumboPlatesStockIn> list = jumboPlatesStockInService.selectJumboPlatesStockInList(jumboPlatesStockIn);
        return getDataTable(list);
    }

    /**
     * 导出原片入库列表
     */
    @PreAuthorize("@ss.hasPermi('system:in:export')")
    @Log(title = "原片入库", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JumboPlatesStockIn jumboPlatesStockIn)
    {
        List<JumboPlatesStockIn> list = jumboPlatesStockInService.selectJumboPlatesStockInList(jumboPlatesStockIn);
        ExcelUtil<JumboPlatesStockIn> util = new ExcelUtil<JumboPlatesStockIn>(JumboPlatesStockIn.class);
        util.exportExcel(response, list, "原片入库数据");
    }

    /**
     * 获取原片入库详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:in:query')")
    @GetMapping(value = "/{keyId}")
    public AjaxResult getInfo(@PathVariable("keyId") Long keyId)
    {
        return success(jumboPlatesStockInService.selectJumboPlatesStockInByKeyId(keyId));
    }

    /**
     * 新增原片入库
     */
    @PreAuthorize("@ss.hasPermi('system:in:add')")
    @Log(title = "原片入库", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JumboPlatesStockIn jumboPlatesStockIn)
    {
        return toAjax(jumboPlatesStockInService.insertJumboPlatesStockIn(jumboPlatesStockIn));
    }

    /**
     * 修改原片入库
     */
    @PreAuthorize("@ss.hasPermi('system:in:edit')")
    @Log(title = "原片入库", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JumboPlatesStockIn jumboPlatesStockIn)
    {
        return toAjax(jumboPlatesStockInService.updateJumboPlatesStockIn(jumboPlatesStockIn));
    }

    /**
     * 删除原片入库
     */
    @PreAuthorize("@ss.hasPermi('system:in:remove')")
    @Log(title = "原片入库", businessType = BusinessType.DELETE)
    @DeleteMapping("/{keyIds}")
    public AjaxResult remove(@PathVariable Long[] keyIds)
    {
        return toAjax(jumboPlatesStockInService.deleteJumboPlatesStockInByKeyIds(keyIds));
    }
}
